1. Field of the Invention
The present invention relates generally to the data processing field, and more particularly, to a computer implemented method, apparatus and computer program product for adjusting a graph in association with a change in state of an object of the graph.
2. Description of the Related Art
A large number of design tools are based on a canvas on which a user can visually place objects in order to compose a graph and, if desired, connect the placed objects with one another. Using so-called free form canvas design tools, the user can place, arrange and resize objects at any position in the graph by utilizing a mouse. Some examples of free form canvas design tools include the following:                1. UML/IE (Unified Modeling Language/Information Engineering) visual designer tools: With these types of tools, a user can design a class hierarchy or a physical database model by placing objects on the canvas and drawing links between the objects. The links indicate the relationships between the classes or tables.        2. Workflow designer tools: With these types of tools, a user can design a workflow by placing objects representing activities on the graph and chaining the objects with arrows. The links indicate the sequence and condition under which the activities are going to be executed.        3. ETL (Extract Transform Load) designer tools: With these types of tools, a user can design a data flow by placing on the graph objects representing data sources, data targets or data transformation steps and by joining the objects with links. The links represent the way data is transferred from one operator to the next.        4. Graphical applications to draw charts or write presentations (Microsoft Powerpoint®, for example): A user can draw objects (geometric figures, cliparts, text, etc.) on the canvas and move and resize the objects with a mouse.        
All the above types of designer tools have a common problem. In particular, when a user is working on an existing graph and wishes to resize an existing object or to add or remove an object; the layout of the graph should be adjusted after the operation so that the use of available space on the graph is optimal. Specifically, the following problems often occur when resizing an existing object in, adding an object to or removing an object from a graph:                1. The user increases the size of an object placed between other objects. After the modification, the modified object overlaps neighboring objects, and the neighboring objects have to be manually moved so that they do not become hidden or do not hide the modified object.        2. The user reduces the size of an object placed between other objects. After the modification, the space between the modified object and neighboring objects is too large so that the graph does not optimally use available space, and the layout of the graph appears inconsistent. In this case, the user will usually want to move the neighboring objects so that the interspace between objects is reduced and the layout appears more consistent.        3. The user wishes to add a new object between two existing objects. The space between the two existing objects is not sufficient to receive the new object, so the user must rearrange the graph to provide space for the new object.        4. The user removes an object from the graph. This removal frees up space on the graph. If the other objects in the graph are not moved so as to utilize the freed up space, the layout of the graph will appear inconsistent and the graph will use more space than necessary.        
As should be apparent from the above examples, an effective mechanism is needed to rearrange or otherwise adjust a graph when one or more of its elements is resized, or an element is removed or added. Such a mechanism is particularly desirable in graphs in which objects can be expanded and collapsed. In such graphs, the objects have at least two possible representations or states, for example, an expanded state of increased size and a compressed state of reduced size. The user can switch from one representation to the other with a simple gesture (double-clicking on the object or clicking on some button in the object, for example). In that case, the size of objects in the graph may be modified frequently (each time the user expands or compresses an object of the graph), and the user is not reasonably able to efficiently rearrange other objects in the graph by hand each time an object is expanded or compressed.
One approach to the problem of adjusting a layout of a graph when an object of the graph is changed is to provide a function which automatically relayouts the graph. By invoking this function, the software will try to compute the best possible layout for the current graph. This solution, however, has several drawbacks:                1. It is usually slow: computing an optimal layout for a free form graph (a graph where the objects are not bound to any geometrical constraint, but can be freely moved at any position on the graph) is a complex, time-consuming operation.        2. The user is often unsatisfied with the result: it is very difficult to find an algorithm that will always produce the optimal layout for any kind of free form graph. In many cases, the arrangement found by the algorithm optimizes the space but does not take into account the semantic or meaning of some objects and the user has to modify the layout manually after the automatic relayout.        3. The algorithm often does not take the existing layout into account: if the user has arranged the objects in a particular order or geometry because it helps him/her find the objects or understand the semantic meaning of the graph, invoking an automatic relayout function will destroy this manual arrangement, and the layout of the graph will be recomputed artificially using the algorithm of the function.        4. Most of the time the user has to arrange the objects manually: Most design tools offer some additional commands to align several selected objects on a line or space them equally, but it does not really help the user react to a size modification (because an object's size has been increased or decreased) in a comfortable way.        
It would, accordingly, be desirable to provide an effective mechanism for automatically adjusting a graph to accomodate a change in state of an object of the graph.